home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / share / Dos / VARIOS / pascal / MAIL.SWG / 0005_JAM Message Base Unit.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-02-21  |  5.2 KB  |  159 lines

  1. {
  2. 12 Jan 96 17:12, Mark Tassin wrote to All:
  3.  MT> Can anybody help me find a Documented JAM message base unit for
  4.  MT> TP 7.0? The one in JAMAPI would suffice except that all of the
  5.  MT> functions that you can perform with it are undocumented, thus I
  6.  MT> have to hunt through a slew function calls guessing what values I
  7.  MT> should pass to them... RADU comes with the ability to post to
  8.  MT> Hudson Message bases, but does not claim to support JAM, can
  9.  MT> anybody point me to something that will let me post messages to
  10.  MT> the JAM message base or am I screwed?
  11.  
  12.  
  13. MKSM106.LZH    226200  12-22-94  MK Source for Msg Access v1.06 - Mark May's
  14.                                  Pascal OOP source code to access Squish,
  15.                                  Jam, Hudson, *.Msg, and Ezycom message
  16.                                  bases. Great for developing BBS utilities.
  17.                                  (FW)
  18.  
  19. Get the above archive,and here is
  20. a generic reader that I put together using Mark's units/source...
  21.  
  22.  
  23. (*   Generic Message Reader by Martin Woods 1:351/233.1      *)
  24. (* To use this you need MKSM106.LZH , Mark May's OOP library *)
  25. (* which should be availible just about anywhere             *)
  26. (* This program will read the following:                     *)
  27. (*          HUDSON,SQUISH,*.MSG,EZY and JAM                  *)
  28. (*    thanks to Mark May for writing a great Library!        *)
  29.  
  30. Program Reader;
  31. {$M 16384, 0, 655360}
  32. {$I MKB.Def}
  33.  
  34. {$X+}
  35.  
  36.   Uses Crt,MKMsgAbs, MKOpen, MKDos, MKstring;
  37.  
  38. Var
  39.   MsgOut: AbsMsgPtr;
  40.   TmpStr: String;
  41.   AreaId: String;
  42.   ch:char;
  43.   a,b: integer;
  44. Const
  45.   StLen = 78;
  46.  
  47. Begin
  48. If (ParamCount < 1) or (ParamStr(1) = '/?') Then
  49.   Begin
  50.   textattr:=$07;
  51.   clrscr;
  52.   writeln;
  53.   textcolor(10);
  54.   writeln('         Generic  READER version 01.0 by Martin Woods,June 1995');
  55.   writeln;
  56.   textcolor(11);
  57.   WriteLn('           Proper syntax is:');
  58.   WriteLn('           READER MsgAreaId');
  59.   WriteLn;
  60.   WriteLn('           Squish MsgAreaId Example = SC:\Max\Msg\Muffin');
  61.   WriteLn('           Hudson MsgAreaId Example = H042C:\RA\MsgBase');
  62.   WriteLn('           *.Msg  MsgAreaId Example = FC:\Mail');
  63.   WriteLn('           Ezy    MsgAreaId Example = E0001C:\Ezy\MsgBase');
  64.   WriteLn('           Jam    MsgAreaId Example = JC:\Msg\General');
  65.   Halt(1);
  66.   End;
  67. AreaId := Upper(ParamStr(1));
  68.  
  69. If Not OpenMsgArea(MsgOut, AreaId) Then
  70.   Begin
  71.     WriteLn('Unable to open message base');
  72.     Halt(4);
  73.  End;
  74.   textattr:=$07;
  75.   clrscr;
  76.   gotoxy(10,8);
  77.   textcolor(10);
  78.   write('Generic READER version 01.0 by Martin Woods,June 1995 '+#13);
  79.   textcolor(7);
  80.   Delay(1500); {opening screen here}
  81.  
  82.   MsgOut^.SeekFirst(1);
  83.  While MsgOut^.SeekFound Do
  84.    Begin
  85.      window(1,1,80,25);
  86.      textbackground(0);
  87.      clrscr;
  88.      textcolor(15);
  89.        for a:=1 to 80 do write('─');  { header starts here }
  90.          textcolor(2);
  91.          MsgOut^.MsgStartUp;
  92.          WriteLn(MsgOut^.GetMsgNum);
  93.          Write('Message Number: ' + Long2Str(MsgOut^.GetMsgNum));
  94.            If MsgOut^.IsPriv Then
  95.              Write('  (Priv)');
  96.                If MsgOut^.IsRcvd Then
  97.                  Write(' (Rcvd)');
  98.                  WriteLn;
  99.                  Write('From: ' + PadRight(MsgOut^.GetFrom,' ',45));
  100.                  Write('Date: ');
  101.                  WriteLn(ReformatDate(MsgOut^.GetDate, 'MM/DD/YY')
  102.                  + ' ' + MsgOut^.GetTime);
  103.                  WriteLn('To: ' + MsgOut^.GetTo);
  104.                  Write('Subj: ');
  105.                  WriteLn(MsgOut^.GetSubj);
  106.                  textcolor(15);
  107.                    for a:=1 to 80 do write('─'); { header ends here }
  108.                      window(1,wherey,80,25); {make a window to scroll message}
  109.                      textcolor(7);
  110.                      textbackground(0);
  111.                      clrscr;
  112.                      WriteLn;
  113.                      MsgOut^.MsgTxtStartUp;
  114.               repeat
  115.  
  116.     TmpStr := MsgOut^.GetString(StLen);
  117.     WriteLn(TmpStr);
  118.     TmpStr := MsgOut^.GetString(StLen);
  119.        if keypressed then
  120.          begin
  121.            ch := readkey;
  122.              if ch = #27 then halt;
  123.           end;
  124.              if ch = #13 then
  125.                begin
  126.                  WriteLn(TmpStr);
  127.               End;
  128.       if wherey > 15 then
  129.         begin
  130.           textcolor(14);
  131.           textbackground(1);
  132.           writeln;
  133.           writeln;
  134.           write(' Esc to Quit  -   Press enter to Continue: '); {status line}
  135.           clreol;
  136.           textattr:=$07;
  137.           ch := readkey;
  138.             if ch = #27 then halt;
  139.               clrscr;
  140.               textcolor(7);
  141.             end;
  142.   until MsgOut^.EOM or (ioresult > 0);
  143.     textcolor(14);
  144.     textbackground(1);
  145.     gotoxy(1,18);  {this is funky,any ideas how to optimize?}
  146.     write(' Esc to Quit  -   Press enter to Continue:                     End
  147. ofMsg: ');clreol; {got word wrapped here}
  148.     ch := readkey;
  149.       if ch = #27 then halt;
  150.         clrscr;
  151.           If Length(TmpStr) > 0 Then
  152.              WriteLn(TmpStr);
  153.                If IoResult <> 0 Then;
  154.                   MsgOut^.SeekNext;
  155.               End;
  156.                  If Not CloseMsgArea(MsgOut) Then;
  157.              End.
  158.  
  159.